package com.android.juvid.testnet;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.lang.reflect.Field;
import java.util.Iterator;
import java.util.Set;

public class MapHash extends AppCompatActivity {
    public String str="第一个字符串";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate( savedInstanceState );
        setContentView( R.layout.activity_map_hash );

        HashMap<String, Object> map = new HashMap<String, Object>();
        ArrayList list = new ArrayList<Map<String, Object>>();
        list.add("000000000");
        list.add("111111111");
        list.add("222222222");
        list.add("333333333");
        list.add("444444444");
        list.add("555555555");
        map.put("数组",list);
        map.put("Juvid","qqqqqq");
        map.put("Jutewei","wwwwww");
        map.put("zhu","fffffff");
        Log.v("字典",map.toString());

        HashMap hm=new HashMap();
        hm.put( "juvid","查找键值");
        hm.put( "jute","找到了键值");
        hm.get("juvid");
//        System.out.println(hm.get("juvid"));
//        System.out.println(hm.get("juvid")+"="+map.get("数组"));
        Log.v("字典",hm.get("jute").toString()+(String)hm.get("juvid")+list.indexOf(1));
//        for(Iterator iter = map.entrySet().iterator();iter.hasNext();){
//            Map.Entry element = (Map.Entry)iter.next();
//            Object strKey = element.getKey();
//            Object strObj = element.getValue();
//            map.get(strKey);
//            System.out.println("map.get(\""+strKey+"\")="+strObj);
//        }
        try {
//            Class c=Class.forName("Class测试.com.tc.test.Class的forname方法获得属性信息.student");//把要使用的类加载到内存中,并且把有关这个类的所有信息都存放到对象c中
        Class clazz = Class.forName("com.android.juvid.testnet.MapHash.Class");//根据类名获得其对应的Class对象 写上你想要的类名就是了
        Field[] fields = clazz.getDeclaredFields();//根据Class对象获得属性 私有的也可以获得
        for(Field f : fields) {
            System.out.println(f.getType().getName());//打印每个属性的类型名字
            Log.v("成功",f.getType().getName());
        }}catch(Exception e) {
            e.printStackTrace();
            Log.v("失败","22222222");
        }

    }
}
